# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : base_api.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2023/12/28 20:16
# @Copyright: 北京码同学
from common.client import RequestsClient


# 买家服务基类
from common.file_load import load_yaml_file
from paths_manager import http_yaml_path


class BaseBuyerApi(RequestsClient):
    # 这是定义的全局性的类属性，来代表买家token，默认是空字符串
    # token赋值必须在其他接口调用之前完成，最终会在自定义的fixture中完成赋值
    buyer_token = ''
    uid = ''
    def __init__(self):
        super().__init__()

        self.host = load_yaml_file(http_yaml_path)['buyer']
        self.headers = {
            "Authorization":BaseBuyerApi.buyer_token
        }

# 卖家服务基类
class BaseSellerApi(RequestsClient):
    # 这是定义的全局性的类属性，来代表卖家token，默认是空字符串
    # token赋值必须在其他接口调用之前完成，最终会在自定义的fixture中完成赋值
    seller_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file(http_yaml_path)['seller']
        self.headers = {
            "Authorization":BaseSellerApi.seller_token
        }

# 管理员服务基类
class BaseManagerApi(RequestsClient):
    # 这是定义的全局性的类属性，来代表管理员token，默认是空字符串
    # token赋值必须在其他接口调用之前完成，最终会在自定义的fixture中完成赋值
    manager_token = ''
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file(http_yaml_path)['manager']
        self.headers = {
            "Authorization":BaseManagerApi.manager_token
        }

# 基础服务基类
class BaseBasicApi(RequestsClient):
    def __init__(self):
        super().__init__()
        self.host = load_yaml_file(http_yaml_path)['basic']